<?php session_start();
header('Content-Type: text/xml');
header("Cache-control: No-Cache");
header("Pragma: No-Cache");
$m = $_POST["m"];
$n = $_POST["n"];
$d = $_POST["table"];
$rows = explode("|", $d);
$map = array();
for($i=0; $i<$m; ++$i){
	$map[$i] = explode("-", $rows[$i]);	
}
$f = $_POST["f"];
$h = fopen($f, "w");
if($h !== false){
	fprintf($h, "%d %d\n", $m, $n);
	for ($i = 0; $i < $m; $i++) {
		for ($j = 0; $j < $n; $j++) {
			fprintf($h, "%d ", $map[$i][$j]);
		}
		fprintf($h, "\n");
	}
	fclose($h);
	echo "true";
} else {
	echo "false";
}
?>